package com.kafka.producer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.support.MessageBuilder;

/**
 * Author : 尤毅鹤
 * Date: 2021/05/20 15:38
 * Description: <描述>
 */

@EnableBinding(Source.class)
@Slf4j
public class SendService {

    @Autowired
    private Source source;

    public void sendMsg(String msg) {
        log.info("发送的数据为{}",msg);
        source.output().send(MessageBuilder.withPayload(msg).build());
    }
}

